<?php
$stratdates = date('Y-m-d');
$addTwosdaysIndate = date("Y-m-d", strtotime("$stratdates +2 day"));
if ($data['start_date'] <= $addTwosdaysIndate) {
    if (isset($data['courses_id']) && !empty($data['courses_id'])) {
        $courseName = $data['course_titile'];
        $userDetails = getUserTypeByClassCourse('Courses', $data['courses_id']);
        $imagePath = getImagePathByClassCourse('Courses', $data['courses_id']);
        $url = $this->createAbsoluteUrl('/courses/viewcourse', array('id' => $data['courses_id']));
        $session = Courses::countCousrseBatchDateSession($data['courses_id']);
        $imageName = (ClassImage::getCoursesPrimaryImage($data['courses_id']) != '') ? baseUrl() . '../../' . SkillConfig::getClassCourseImagePath($imagePath) . '240X180/' . ClassImage::getCoursesPrimaryImage($data['courses_id']) : baseUrl() . '../../' . getUploadDir() . '/no-class-image-240X180.jpg';
        $booknow = ($data['course_type_id'] == COURSE_CLASS_TYPE) ? 'Make Query' : 'Book Now';
        $priceRange = CourseBatche::findMinMaxPriceByClassbatchforCategoryPage($data['courses_id']);
        $trainerResponse = MakeQuery::trainerResponseRate($data['front-user'], $data['backend-user']);
        $coursePrice = 'COURSE PRICE';
        $levelType = classCourseLevelType('Courses', $data['courses_id']);
        $getVenues = Courses::getCourseWithVenues($data['courses_id']);
        $locationName = ClassVenue::getLocationNameBycourseVenueId($getVenues);
        $batchStartDate = date('D, d  M', strtotime($data['start_date'])) . '  -  ' . date('D, d  M', strtotime($data['end_date']));
    } else {
        $coursePrice = 'CLASS PRICE';
        $courseName = $data['class_titile'];
        $userDetails = getUserTypeByClassCourse('Classes', $data['classes_id']);
        $imagePath = getImagePathByClassCourse('Classes', $data['classes_id']);
        $url = $this->createAbsoluteUrl('/classes/viewclass', array('id' => $data['classes_id']));
        $session = '&nbsp;&nbsp;&nbsp;&nbsp;' . CLASS_NO_SESSION;
        $imageName = (ClassImage::getPrimaryImage($data['classes_id']) != '') ? baseUrl() . '../../' . SkillConfig::getClassCourseImagePath($imagePath) . '240X180/' . ClassImage::getPrimaryImage($data['classes_id']) : baseUrl() . '../../' . getUploadDir() . '/no-class-image-240X180.jpg';
        $booknow = ($data['class_type_id'] == CURATED_CLASS_TYPE) ? 'Book Now' : 'Make a Query ';
        $priceRange = ClassBatch::findMinMaxPriceByClassbatchforCategoryPage($data['classes_id']);
        $trainerResponse = MakeQuery::trainerResponseRate($data['front-user'], $data['backend-user']);
        $levelType = classCourseLevelType('Classes', $data['classes_id']);
        $getVenues = Classes::getclassWithVenues($data['classes_id']);
        $locationName = ClassVenue::getLocationNameByVenueId($getVenues);
        $batchStartDate = date('D, d  M', strtotime($data['start_date']));
    }
    ?>
    <li class="span3">                   	
        <div class="info">
            <div class="padding20px">
                <a href="<?php echo $url; ?>" ><?php echo '<img src="' . $imageName . '"  alt="' . $courseName . '" id="imgClass">'; ?></a>                   
                <h6 class="classcourseHeight"><a href="<?php echo $url; ?>" ><?php echo substrclasscourname($courseName); ?></a></h6>
                <div class="height1px addmarginB15 dash-borB"></div>
                <p class="location"><?php echo $locationName; ?></p>
                <div class="height1px addmarginB15 dash-borB"></div>
                <p class="date"><?php echo $batchStartDate; ?></p>
                <div class="height1px addmarginB15 dash-borB"></div>
                <p class="price"><span class="font-rupee"></span><?php echo $priceRange; ?><br /><span class="font-opensansreg"><?php echo $coursePrice; ?></span></p>
                <div class="height1px addmarginB15 dash-borB"></div>
                <ul class="class-info">
                    <li class="sessionBlock">
                        <em title="Sessions" class="sprite masterTooltip">&nbsp;</em>
                        <span><?php echo $session; ?></span>
                    </li>
                    <li class="levelBlock">
                        <em title="Level" class="sprite masterTooltip">&nbsp;</em>
                        <span><?php echo $levelType; ?></span>
                    </li>
                    <li class="rateBlock">
                        <em title="Response Rate" class="sprite masterTooltip">&nbsp;</em>
                        <span><?php echo (!empty($trainerResponse) ? $trainerResponse . '%' : TRAINER_RESPONSE_RATE); ?></span>
                    </li>
                </ul>                            
                <div class="height1px addmarginB15 dash-borB"></div>
                <a href="<?php echo $url; ?>" class="btn-green"><?php echo $booknow; ?></a>
            </div>
        </div>                    
    </li>
<?php } ?>